<?php
class ControllerModuleManufacturer extends Controller {
	protected function index($setting) {
		$this->language->load('module/manufacturer');
		
		$this->data['heading_title'] = $this->language->get('heading_title');
		
				
		$this->load->model('catalog/manufacturer');
	
		$this->load->model('tool/image');
		
		$this->data['manufacturers'] = array();
		
		$data = array(
			
			'start' => 0,
			'limit' => $setting['limit']
			
		);

		$results = $this->model_catalog_manufacturer->getManufacturers($data);;

		foreach ($results as $result) {
			
			if ($result['image']) {
				$image = $this->model_tool_image->resize($result['image'], $setting['image_width'], $setting['image_height']);
			} else {
				$image = $this->model_tool_image->resize('no_image.jpg', $setting['image_width'], $setting['image_height']);
			}
						
			
			
			$this->data['manufacturers'][] = array(
				
				'thumb'   	 => $image,
				'name'    	 => $result['name'],
				'href'    	 => $this->url->link('product/manufacturer/info', 'manufacturer_id=' . $result['manufacturer_id']),
			);
		}

		if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/module/manufacturer.tpl')) {
			$this->template = $this->config->get('config_template') . '/template/module/manufacturer.tpl';
		} else {
			$this->template = 'default/template/module/manufacturer.tpl';
		}

		$this->render();
	}
}
?>